package com.hxfeng.authdemo.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class ApiController {

    @RequestMapping("hello")
    @PreAuthorize("hasAuthority('hello')")
    public String gethello() {
        return "hello";
    }

    @PreAuthorize("hasAuthority('world')")
    @RequestMapping("world")
    public String getworld() {
        return "world";
    }
}
